<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="./../template/template.xhtml">
	<ui:define name="content">
		<h:form>
			<div class="FORM_HEADER">Edit Employee</div>
			<h:panelGrid columns="2" styleClass="APPLICATION_CONTENT"
				cellpadding="2">
				<h:outputText value="" />
				<h:inputHidden id="id" value="#{employeeController.employeeDTO.id}" />

				<p:outputLabel value="First Name: " for="firstName" />
				<h:inputText id="firstName"
					value="#{employeeController.employeeDTO.firstName}" required="true"
					requiredMessage="Field cannot be empty!"
					validatorMessage="Allowed value length is Min: 3 and Max 20.">
					<f:validateLength for="firstName" minimum="2" maximum="20" />
				</h:inputText>

				<p:outputLabel value="Last Name: " for="lastName" />
				<h:inputText id="lastName"
					value="#{employeeController.employeeDTO.lastName}" />

				<p:outputLabel value="Destination: " for="destination" />
				<h:selectOneMenu id="destination"
					value="#{employeeController.employeeDTO.destinationId}">
					<f:selectItems value="#{employeeController.destinationList}"
						var="destination" itemLabel="#{destination.name}"
						itemValue="#{destination.id}" />
				</h:selectOneMenu>

				<p:outputLabel value="Emp. Code: " for="empCode" />
				<h:inputText id="empCode"
					value="#{employeeController.employeeDTO.empCode}" required="true">
					<f:validateLength for="empCode" minimum="3" maximum="12" />
				</h:inputText>

				<p:outputLabel value="Email: " for="email" />
				<h:inputText id="email"
					value="#{employeeController.employeeDTO.emailId}" required="true">
					<f:validator
						validatorId="com.opgea.token.web.validator.EmailValidator" />
					<f:validateLength minimum="6" maximum="40" />
				</h:inputText>

				<h:outputText value="" />
				<p:commandButton value="Save" action="#{employeeController.save}"
					ajax="true" />
			</h:panelGrid>
		</h:form>
	</ui:define>
</ui:composition>
</html>